#include<stdio.h>
int main()
{
    int n, i = 0, max = 0;
    scanf("%d", &n);
    while (n != 1)
    {
        int tmp = n % 2;
        if (tmp == 0)
        {
            n = n / 2;
            i++;
        }
        else if (tmp == 1)
        {
            n = n * 3 + 1;
            i++;
        }

        if (max < n)
        {
            max = n;
        }
    }
    printf("%d", max);
    return 0;
}